<?php
/**
 * Formerly you could delete page's, for security-issues this isn't
 * possible anymore.
 *
 * @author Xander Hoogland <home@xanland.nl>
 * @package ACP
 * @deprecated
 */

session_start();
include('../includes/index.php');
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
	$sql = "SELECT titel, pagina_id FROM `pagina` WHERE `pagina_id` = " . $_POST['pagina'] . " AND `active` = 1;";
	$query = mysql_query ($sql);
	$output = mysql_fetch_assoc ($query);
	//$sql2 = "DELETE FROM `pagina` WHERE `pagina_id` = " . $pagina . ";";
	$sql2 = "UPDATE `pagina` SET `active` = 0 WHERE `pagina_id` = '" . $pagina . "';";
	mysql_query($sql2);
	echo 'De pagina ' . $output['titel'] . ' is met succes \'verwijderd\'.';
}
else
{
?>
	<div style="margin-left: 40px;"><form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
	Welke pagina:<br />
	<?php
	$query = mysql_query ("SELECT pagina_id, titel FROM pagina WHERE `active` = 1;");
	echo '<select name="pagina">';
	while ($result = mysql_fetch_assoc ($query))
	{
		echo '<option value="' . $result['pagina_id'] . '">' . $result['titel'] . '</option>' . "\n";
	}
	echo '</select>';
	?>
	<br /><br />
	<input type="submit" value="Verwijder pagina">&nbsp;&nbsp;<input type="reset" value="Leeg formulier"></form></div>
<?php
}
//print_r ($_SESSION);
?>